﻿<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
    CodeFile="ModifyItemMaintain.aspx.vb" Inherits="WebForm_Manage_ModifyItemMaintain" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table>
                <tr style="vertical-align: text-top">
                    <td>
                        <asp:HiddenField ID="hiUID" runat="server" />
                        <asp:HiddenField ID="hiKind" runat="server" />
                       
                     <asp:Label ID="lblTitle" runat="server"  meta:resourcekey="lblTitle"></asp:Label>
                        <br />
                        <asp:Label ID="lblsuit_site" runat="server" meta:resourcekey="lblsuit_site"></asp:Label>
                        <asp:DropDownList ID="ddlsuit_site" runat="server" AutoPostBack="True" DataSourceID="objDSsite"
                            DataTextField="site_name" DataValueField="site_code">
                        </asp:DropDownList>
                        <asp:Button ID="btnInsert" runat="server" meta:resourcekey="btnInsert" />
                        <br />
                        <asp:ObjectDataSource ID="objDSsite" runat="server" SelectMethod="GetAllSite" TypeName="Telecom.BBL.SiteBBL">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <asp:ObjectDataSource ID="objDSModifyItem" runat="server" TypeName="Telecom.BBL.ModifyItemBLL" SelectMethod="GetMODIFYItem" UpdateMethod="UpdateMODIFYItem">
                                <UpdateParameters>
                                    <asp:Parameter Name="canModi" Type="Boolean" />
                                    <asp:Parameter Name="ModifyItem_code" Type="String" />
                                    <asp:Parameter Name="ModifyItem_name" Type="String" />         
                                    <asp:Parameter Name="ModifyItem_desc" Type="String" />
                                    <asp:Parameter Name="OrginalData" Type="Boolean" />
                                    <asp:Parameter Name="NeedApprove" Type="Int16" />
                                    <asp:Parameter Name="Kind" Type="String" />
                                    <asp:Parameter Name="Message" Type="String" DefaultValue ="" ConvertEmptyStringToNull="false" />
                                    <asp:ControlParameter ControlID="ddlsuit_site" Name="suit_site" 
                                        PropertyName="SelectedValue" Type="String" />
                                    <asp:ControlParameter ControlID="hiUID" Name="UID" PropertyName="Value" 
                                        Type="String" />
                                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" />
                                    <asp:Parameter Name="ChkOA" />
                                </UpdateParameters>
                               <SelectParameters>
                                    <asp:ControlParameter ControlID="ddlsuit_site" Name="suit_site" 
                                        PropertyName="SelectedValue" Type="String" />
                                    <asp:ControlParameter ControlID="hiKind" ConvertEmptyStringToNull="False" 
                                        Name="Kind" PropertyName="Value" Type="String" />
                                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" 
                                        Type="String" />
                               </SelectParameters>
                        </asp:ObjectDataSource> 
                         <asp:ObjectDataSource ID="objDSKind" runat="server" SelectMethod="GetKindData" TypeName="Telecom.BBL.ModifyItemBLL">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <asp:HiddenField ID="hiDBName" runat="server" />

                        <TServerControl:TGridView ID="gvMODIFYItem" runat="server" AllowHoverEffect="True"
                            AllowHoverSelect="True" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="objDSModifyItem"
                            ShowFooterWhenEmpty="False" ShowHeaderWhenEmpty="True" SkinID="pager" 
                            TotalRowCount="0">
                            <Columns>
                                <asp:TemplateField>
                                    <EditItemTemplate>
                                        <asp:Button ID="btnUpdate" runat="server" CommandName="Update" meta:resourcekey="btnUpdate" />
                                        <asp:Button ID="btnCancel" runat="server" CommandName="Cancel"  meta:resourcekey="btnCancel" />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Button ID="btnEdit" runat="server" CommandName="Edit"  meta:resourcekey="btnEdit"
                                        />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvModifyItem_code">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtModifyItem_code" runat="server" Enabled='<%# Bind("canModi") %>' Text='<%# Bind("ModifyItem_code") %>'
                                            Width="68px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblModifyItem_code" runat="server" Text='<%# Bind("ModifyItem_code") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField  meta:resourcekey="gvModifyItem_name">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtModifyItem_name" runat="server"  Text='<%# Bind("ModifyItem_name") %>'
                                            Width="68px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblModifyItem_name" runat="server" Text='<%# Bind("ModifyItem_name") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvModifyItem_desc">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtModifyItem_desc" runat="server"  Text='<%# Bind("ModifyItem_desc") %>'
                                            Width="68px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblModifyItem_desc" runat="server" Text='<%# Bind("ModifyItem_desc") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvNeedApprove">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtNeedApprove" runat="server"  Text='<%# Bind("NeedApprove") %>'
                                            Width="68px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblNeedApprove" runat="server" Text='<%# Bind("NeedApprove") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvChkOA">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="cbChkOA" Checked='<%# Bind("ChkOA") %>' runat="server" />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="cbChkOAt" Checked='<%# Bind("ChkOA") %>' runat="server" Enabled="False" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvOrginalData">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="cbEditOrginalData" runat="server" Checked='<%# Bind("OrginalData") %>' />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                         <asp:CheckBox ID="cbOrginalData" runat="server" Checked='<%# Bind("OrginalData") %>'  Enabled="False" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField  meta:resourcekey="gvKind">
                                    <EditItemTemplate>
                                     <asp:DropDownList ID="ddlKind" runat="server" DataSourceID="objDSKind" DataTextField="Name"
                                                DataValueField="Kind" SelectedValue='<%# Bind("Kind") %>'>
                                            </asp:DropDownList>

                                    </EditItemTemplate>
                                    <ItemTemplate>
                                         <asp:DropDownList ID="ddlKind" runat="server" DataSourceID="objDSKind" DataTextField="Name"
                                                DataValueField="Kind" SelectedValue='<%# Bind("Kind") %>' Enabled="false" > 
                                            </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvMessage">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtMessage" runat="server"  Text='<%# Bind("Message") %>'
                                            Width="68px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblMessage" runat="server" Text='<%# Bind("Message") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField  meta:resourcekey="gvCrtName">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCrtName" runat="server" Text='<%# Eval("CrtName") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField  meta:resourcekey="gvCrtDate">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCrtDate" runat="server" Text='<%# Eval("CrtDate","{0:yyyy/MM/dd}") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvModiName">
                                    <ItemTemplate>
                                        <asp:Label ID="lblModiName" runat="server" Text='<%# Eval("ModiName") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvModiDate">
                                    <ItemTemplate>
                                        <asp:Label ID="lblModiDate" runat="server" Text='<%# Eval("ModiDate","{0:yyyy/MM/dd}") %>'
                                            Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvSetup">
                                   <EditItemTemplate>
                                   </EditItemTemplate>
                                    <ItemTemplate>
                                            <asp:Button ID="btnSetup" CommandName="Select" runat="server" meta:resourcekey="btnSetup"
                                            CommandArgument='<%# Bind("ModifyItem_code") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </TServerControl:TGridView>
      
                        <br />
                    </td>
                  </tr>
                  </table>
    </ContentTemplate>
  </asp:UpdatePanel>
  <asp:UpdatePanel ID="up" runat="server">
        <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server" BackColor="white" BorderWidth="1" Style="cursor: move;" Width="600px">
                 <table>
                  <tr>
                    <td>
                        <br />
                        <asp:HiddenField ID="hiKindDetail" runat="server" />
                        <asp:HiddenField ID="hiModifyItem_code" runat="server" />
                        <asp:Button ID="btnInsertDetail" runat="server" meta:resourcekey="btnInsertDetail" Visible="false" />
                        <asp:ObjectDataSource ID="objDSMODIFYItemKind" runat="server" TypeName="Telecom.BBL.ModifyItemBLL" 
                         SelectMethod="GetMODIFYItemKind" UpdateMethod="InsertMODIFYItemKind" DeleteMethod="DeleteMODIFYItemKind">
                             <DeleteParameters>
                                    <asp:ControlParameter ControlID="hiModifyItem_code" Name="ModifyItem_code" PropertyName="Value"
                                        Type="String" />
                                    <asp:ControlParameter ControlID="ddlsuit_site" Name="suit_site" PropertyName="SelectedValue"
                                        Type="String" />
                                    <asp:Parameter Name="kind_code" Type="String" />
                                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" Type="String" />
                              </DeleteParameters>
                              <UpdateParameters>
                                    <asp:ControlParameter ControlID="ddlsuit_site" Name="suit_site" PropertyName="SelectedValue"
                                        Type="String" />
                                    <asp:ControlParameter ControlID="hiModifyItem_code" Name="ModifyItem_code" PropertyName="Value"
                                        Type="String" />
                                    <asp:ControlParameter ControlID="hiUID" Name="UID" PropertyName="Value" Type="String" />
                                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" Type="String" />
                                </UpdateParameters>
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="ddlsuit_site" Name="suit_site" PropertyName="SelectedValue"
                                        Type="String" />
                                    <asp:ControlParameter ControlID="hiModifyItem_code" Name="ModifyItem_code" PropertyName="Value"
                                        Type="String" />
                                    <asp:ControlParameter ControlID="hiKindDetail" ConvertEmptyStringToNull="False" Name="Kind"
                                        PropertyName="Value" Type="String" />
                                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" Type="String" />
                                </SelectParameters>
                        </asp:ObjectDataSource>
                        <asp:ObjectDataSource ID="objDSMODIFY_KIND" runat="server" SelectMethod="GetMODIFY_KIND"
                                TypeName="Telecom.BBL.ModifyItemBLL">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="ddlsuit_site" Name="suit_site" PropertyName="SelectedValue"
                                        Type="String" ConvertEmptyStringToNull="False" />
                                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" Type="String"
                                        DefaultValue="" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        <TServerControl:TGridView ID="gvMODIFYItemKind" runat="server" 
                            AllowHoverEffect="True" AllowHoverSelect="True" AllowPaging="True" 
                            AutoGenerateColumns="False" DataSourceID="objDSMODIFYItemKind" ShowFooterWhenEmpty="False" 
                            ShowHeaderWhenEmpty="True" SkinID="pager" TotalRowCount="0" 
                            Visible="False">
                            <Columns>
                                <asp:TemplateField>
                                     <EditItemTemplate>
                                            <asp:Button ID="btnUpdate" runat="server" CommandName="Update" meta:resourcekey="btnUpdate" />
                                            <asp:Button ID="btnCancel" runat="server" CommandName="Cancel" meta:resourcekey="btnCancel" />
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Button ID="btnDelete" runat="server" CommandName="Delete"  meta:resourcekey="btnDelete"
                                                CommandArgument='<%# Eval("ModifyItem_code") %>' />
                                        </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="gvKindModifyItem_code">
                                    <ItemTemplate>
                                        <asp:Label ID="lblKindModifyItem_code" runat="server" Text='<%# Bind("ModifyItem_code") %>' Width="68px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField  meta:resourcekey="gvkind_code">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="ddlMODIFY_KIND" runat="server" DataSourceID="objDSMODIFY_KIND" DataTextField="kind_name"
                                                DataValueField="kind_code" SelectedValue='<%# Bind("kind_code") %>'>
                                            </asp:DropDownList>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblkind_code" runat="server" Text='<%# Bind("kind_code") %>' visible="false"></asp:Label>
                                            <asp:Label ID="lblkind_name" runat="server" Text='<%# Bind("kind_name") %>' Width="68px"></asp:Label>
                                        </ItemTemplate>
                                  </asp:TemplateField>
                                  <asp:TemplateField  meta:resourcekey="ColStatus" >
                                      <ItemTemplate>
                                          <asp:CheckBox ID="cbStatus" runat="server" Checked='<%# Bind("Status") %>' 
                                              Enabled="False" />
                                      </ItemTemplate>
                                      <EditItemTemplate>
                                          <asp:CheckBox ID="cbStatus" runat="server" Checked='<%# Bind("Status") %>' />
                                      </EditItemTemplate>
                                </asp:TemplateField>
                                  <asp:TemplateField meta:resourcekey="gvKindCrtName">
                                        <ItemTemplate>
                                            <asp:Label ID="lblKindCrtName" runat="server" Text='<%# Eval("CrtName") %>' Width="68px"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField meta:resourcekey="gvKindCrtDate">
                                        <ItemTemplate>
                                            <asp:Label ID="lblKindCrtDate" runat="server" Text='<%# Eval("CrtDate","{0:yyyy/MM/dd}") %>' Width="68px"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                            </Columns>
                        </TServerControl:TGridView>
   
                    </td>
                </tr>
                <tr>
                      <td align="center">
                            <asp:Button ID="btnExit" runat="server" Text="<%$ Resources:Cancel%>" />
                      </td>
                 </tr>
                </table>
              </asp:Panel>
            <asp:Button ID="btnDummy" runat="server" Style="display: none" SkinID="null" />
            <ajaxToolkit:ModalPopupExtender ID="mpSearch" runat="server" TargetControlID="btnDummy"  X="30"
            PopupControlID="panel1" CancelControlID="btnExit" PopupDragHandleControlID="panel1" /> 

        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
